/*
 * @Author: fhw
 * @Date: 2022-07-27 10:21:06
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-02-03 23:28:43
 * @Description:
 */
import { ApiProperty } from '@nestjs/swagger'
import { ChatUser } from 'src/chat_user/entities/chat_user.entity'
import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'
import { PaginatedResult } from '../../common/entities/entities'

@Entity('article_tag')
export class Tags {
  @ApiProperty({ example: 'id', description: 'id' })
  @PrimaryGeneratedColumn()
  id: number

  @ApiProperty({ example: 'name', description: '名称' })
  @Column({
    type: 'varchar',
    length: 255,
  })
  name: string
  @ApiProperty({ example: 'date', description: '创建时间' })
  @CreateDateColumn({
    type: 'datetime',
    comment: '创建时间',
  })
  createDate: string;

  @ApiProperty({ example: 'updateDate', description: '更新时间' })
  @UpdateDateColumn({
    type: 'datetime',
    comment: '更新时间',
  })
  updateDate: string;
  @ApiProperty({ example: 'userId', description: '发布者id' })
  @Column({
    type: 'int',
    nullable: true,
    comment: '发布者id',
  })
  userId: number;
  @ManyToOne(() => ChatUser, (user) => user.id)
  @JoinColumn()
  user: ChatUser;
}
export class TagResult extends PaginatedResult {
  @ApiProperty({
    example: Tags,
    type: [Tags],
  })
  data: Tags[]
  @ApiProperty({ example: 'pageSize', description: '数量' })
  pageSize: number
  @ApiProperty({ example: 'pageNum', description: '页数' })
  pageNum: number
  @ApiProperty({ example: 'total', description: '总数' })
  total: number
}
